<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"/>
    <script src="js/jquery-1.11.3.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/bootstrap/boostrap-hover-dropdown.js">
    </script>
    <script src="js/bootstrap.min.js" type="text/javascript"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrap/css/bootstrap.min.css" type="text/css"/>
    <script src="${pageContext.request.contextPath}/jQuery/jquery-1.11.3.min.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <style>
        body {
            margin-top: 20px;
            margin: 0 auto;
            width: 100%;
        }

        .carousel-inner .item img {
            width: 100%;
            height: 300px;
        }

    </style>
</head>

<body>
<!-- 引入header.jsp -->
<jsp:include page="/WEB-INF/view/header.jsp"></jsp:include>

<div class="container">
    <div class="row">
        <c:forEach var="article" items="${pageBean.list}">
            <div class="col-md-10" style="line-height:50px;">
                <li>
                    <a href="${pageContext.request.contextPath }/article?method=details&articleId=${article.articleId}&userId=${sessionScope.titleAllList.get(i).getArticleId()}"> ${article.title}</a>
                </li>
            </div>
        </c:forEach>
    </div>
</div>
<!-- items 			- 总条数
     maxPageItems   - 页面显示数
     maxIndexPages  - 页码标签最多显示数
     url 			- 访问的url
-->
<div style="margin:auto; text-align: center;">

    <ul class="pagination" style="text-align: center; margin-top: 10px;">
        <pg:pager items="${requestScope.pageBean.total}"
                  export="currentPageNumber=pageNumber" maxPageItems="${requestScope.pageBean.pagerNum}"
                  maxIndexPages="10"
                  isOffset="true" url="${pageContext.request.contextPath}/article">
            <!-- pg:param传递url对应的参数数据 -->
            <pg:param name="method" value="articleList"/>
            <pg:param name="categoryId" value="${requestScope.categoryId}"/>
            <c:if test="${currentPageNumber == 1}">
                <li class="disabled">
                    <a href="javascript:void(0);" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
                </li>
            </c:if>
            <c:if test="${currentPageNumber != 1}">
                <li>
                    <pg:prev>
                        <a href="${pageUrl}" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
                    </pg:prev>
                </li>
            </c:if>
            <pg:pages>
                <c:choose>
                    <c:when test="${currentPageNumber eq pageNumber}">
                        <li class="active"><a href="javascript:void(0);">${pageNumber}</a></li>
                    </c:when>
                    <c:otherwise>
                        <li><a href="${pageUrl }">${pageNumber }</a></li>
                    </c:otherwise>
                </c:choose>
            </pg:pages>
            <c:choose>
                <c:when test="${currentPageNumber == requestScope.pageBean.pages}">
                    <li class="disabled">
                        <a href="javascript:void(0);" aria-label="Next"><span aria-hidden="true">&raquo;</span></a>
                    </li>
                </c:when>
                <c:otherwise>
                    <li>
                        <pg:next>
                            <a href="${pageUrl}"><span aria-hidden="true">&raquo;</span></a>
                        </pg:next>
                    </li>
                </c:otherwise>
            </c:choose>
        </pg:pager>
    </ul>
</div>

<!-- 引入footer.jsp -->
<jsp:include page="/WEB-INF/view/footer.jsp"></jsp:include>

</body>

</html>